//
//  PartyImageTableViewCell.m
//  OneDay
//
//  Created by lanou3g on 15/10/30.
//  Copyright © 2015年 oneDay. All rights reserved.
//

#import "PartyImageTableViewCell.h"

@implementation PartyImageTableViewCell

// 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.cellImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, kWidth - 20, 100)];
        [self addSubview:self.cellImageView];
    }
    return self;
}

- (void)setModel:(DescriptionModel *)model
{
    CGRect newFrame = self.cellImageView.frame;
    NSArray *array = model.size;
    if (array.count > 0) {
        CGFloat height = ([array[0] integerValue] / [array[1] integerValue]) *(kWidth - 20);
        newFrame.size = CGSizeMake(kWidth - 20, height);
    }else{
        newFrame.size = CGSizeMake(kWidth - 20, 250);
    }
    
    self.cellImageView.frame = newFrame;
    [self.cellImageView sd_setImageWithURL:[NSURL URLWithString:model.content] placeholderImage:nil];
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
